//
// Created by jerry on 2024/6/5.
//
#include "sort.h"
void initList(SqList *list, int length)
{
    int i = 1;
    list->length = length;
    list->r = (int *)malloc((list->length + 1) * sizeof(int));
    if (list->r == NULL)
    {
        perror("数组内存申请失败\n");
        exit(1);
    }
    while (1)
    {
        if (i > list->length)
            break;
        if (scanf("%i", (list->r) + i) != 1)
        {
            EXCEPTION;
            continue;
        }
        i++;
    }
}
void showList(SqList list)
{
#ifdef DEBUG
    printf("\n[%d]\t", *list.r);
#endif
    for (int i = 1; i <= list.length; i++)
    {
        printf("%d ", list.r[i]);
    }
    printf("\n");
}